/**
 * Author : Jorge Mejuto Create : 25/05/2010
 */

package net.eyra.negocio.explotacion.informes.diario.DatosExternos;

import java.io.IOException;
import java.net.ConnectException;
import java.net.MalformedURLException;

import net.eyra.utiles.Path;

import com.itextpdf.text.BadElementException;
import com.itextpdf.text.Image;

public class DatosMeteored {

    public Image CargarImagenPronostico() throws BadElementException, MalformedURLException, IOException {
        String s_url = "http://imagenes.meteored.com/gfs_meteored/GFS024_ESP0_SFC.gif";

        try {
            return Image.getInstance(s_url);
        } catch (ConnectException e) {
            s_url = Path.getPathImagenes() + "no_imagen_omel.gif";
            try {
                return Image.getInstance(s_url);
            } catch (MalformedURLException e1) {
                e1.printStackTrace();
                return null;
            } catch (IOException e1) {
                e1.printStackTrace();
                return null;
            }
        } catch (IOException e) {
            s_url = Path.getPathImagenes() + "no_imagen_omel.gif";
            try {
                return Image.getInstance(s_url);
            } catch (MalformedURLException e1) {
                e1.printStackTrace();
                return null;
            } catch (IOException e1) {
                e1.printStackTrace();
                return null;
            }
        }
    }

    public Image CargarImagenIsobaras() throws BadElementException, MalformedURLException, IOException {
        String s_url = "http://www.infomet.fcr.es/metoffice/mapa2.gif";

        try {
            return Image.getInstance(s_url);
        } catch (ConnectException e) {
            s_url = Path.getPathImagenes() + "no_imagen_omel.gif";
            try {
                return Image.getInstance(s_url);
            } catch (MalformedURLException e1) {
                e1.printStackTrace();
                return null;
            } catch (IOException e1) {
                e1.printStackTrace();
                return null;
            }
        } catch (IOException e) {
            s_url = Path.getPathImagenes() + "no_imagen_omel.gif";
            try {
                return Image.getInstance(s_url);
            } catch (MalformedURLException e1) {
                e1.printStackTrace();
                return null;
            } catch (IOException e1) {
                e1.printStackTrace();
                return null;
            }
        }
    }
}
